package top.infopub.enums.cap;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum CapProcessDetailTypeEnum {
    PRO_NODE_TYPE1("1", "授信管理"),
    PRO_NODE_TYPE2("2", "融资初调"),
    PRO_NODE_TYPE3("3", "融资尽调"),
    PRO_NODE_TYPE4("4", "融资立项"),
    PRO_NODE_TYPE5("5", "资料报审"),
    PRO_NODE_TYPE6("6", "融资跟踪"),
    PRO_NODE_TYPE7("7", "金融批复"),
    PRO_NODE_TYPE8("8", "金融机构选择"),
    PRO_NODE_TYPE9("9", "借款合同"),
    PRO_NODE_TYPE10("10", "保证合同"),
    PRO_NODE_TYPE11("11", "质押合同"),
    PRO_NODE_TYPE12("12", "抵押合同"),
    PRO_NODE_TYPE13("13", "合同评审"),
    PRO_NODE_TYPE14("14", "还款计划"),
    PRO_NODE_TYPE15("15", "融资方案"),
    PRO_NODE_TYPE16("16", "融资放款"),
    PRO_NODE_TYPE17("17", "融资还款"),
    PRO_NODE_TYPE18("18", "融资付息"),
    PRO_NODE_TYPE19("19", "融资付费申请")
    ;

    private String node;

    private String nodeName;

    CapProcessDetailTypeEnum(String node, String nodeName) {
        this.node = node;
        this.nodeName = nodeName;
    }

    public static CapProcessDetailTypeEnum getByNode(String node) {
        if (StringUtils.isBlank(node)) return null;
        for (CapProcessDetailTypeEnum ppdt : CapProcessDetailTypeEnum.values()) {
            if (StringUtils.equals(node, ppdt.getNode())) {
                return ppdt;
            }
        }
        return null;
    }

    public static List<Map<String, String>> asList() {
        List<Map<String, String>> list = new ArrayList<>();
        Map<String, String> map;
        for (CapProcessDetailTypeEnum pce : CapProcessDetailTypeEnum.values()) {
            map = new HashMap<>();
            map.put("node", pce.getNode());
            map.put("nodeName", pce.getNodeName());
            list.add(map);
        }
        return list;
    }

    public String getNode() {
        return node;
    }

    public void setNode(String node) {
        this.node = node;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }
}
